package server;

/**
 * @author user
 */
public abstract class HttpServlet implements Servlet {


    /**
     * get
     *
     * @param request  请求对象
     * @param response 响应
     */
    public abstract void doGet(Request request, Response response);

    /**
     * post
     *
     * @param request  请求
     * @param response 响应
     */
    public abstract void doPost(Request request, Response response);


    @Override
    public void service(Request request, Response response) throws Exception {
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }
}
